package com.turing.post.cardmanagement.util;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

/**
 * 调拨单状态迁移明细
 * 
 * @author ys
 * @date 2012-12-17
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "TransferOrderActionDetail")
@IdClass(TransferOrderActionDetail.class)
public class TransferOrderActionDetail implements Serializable {

	/**
	 * 调拨单ID
	 */
	private BigInteger TransferOrderId;
	/**
	 * 操作时间
	 */
	private Date ActionTime;
	/**
	 * 操作员ID
	 */
	private BigInteger operId;
	/**
	 * 初始处理状态
	 */
	private String INITIALSTATUS;
	/**
	 * 结束处理状态
	 */
	private String ENDSTATUS;
	/**
	 * 操作类型
	 */
	private String actionType;
	/**
	 * 备注
	 */
	private String remark;
	
	/**
	 * 调拨创建
	 */
	public final static String TRANSFERORDERACTIONDETAIL_ACTIONTYPE_CREATE = "9";

	/**
	 * 调出确认
	 */
	public final static String TRANSFERORDERACTIONDETAIL_ACTIONTYPE_OUTPASS = "0";
	/**
	 * 接收
	 */
	public final static String TRANSFERORDERACTIONDETAIL_ACTIONTYPE_RECEIVE = "1";
	/**
	 * 接收确认
	 */
	public final static String TRANSFERORDERACTIONDETAIL_ACTIONTYPE_CONFIRMATIONRECEIVE = "2";
	/**
	 * 拒收
	 */
	public final static String TRANSFERORDERACTIONDETAIL_ACTIONTYPE_REFUSE = "3";
	/**
	 * 取消调出
	 */
	public final static String TRANSFERORDERACTIONDETAIL_ACTIONTYPE_OUTCANCEL = "4";

	@Id
	@Column(name = "TRANSFERORDERID", nullable = false)
	public BigInteger getTransferOrderId() {
		return TransferOrderId;
	}

	public void setTransferOrderId(BigInteger transferOrderId) {
		TransferOrderId = transferOrderId;
	}

	@Id
	@Column(name = "ACTIONTIME", nullable = false)
	public Date getActionTime() {
		return ActionTime;
	}

	public void setActionTime(Date actionTime) {
		ActionTime = actionTime;
	}

	@Column(name = "OPERID", nullable = false)
	public BigInteger getOperId() {
		return operId;
	}

	public void setOperId(BigInteger operId) {
		this.operId = operId;
	}

	@Column(name = "INITIALSTATUS", nullable = false)
	public String getINITIALSTATUS() {
		return INITIALSTATUS;
	}

	public void setINITIALSTATUS(String initialstatus) {
		INITIALSTATUS = initialstatus;
	}

	@Column(name = "ENDSTATUS", nullable = false)
	public String getENDSTATUS() {
		return ENDSTATUS;
	}

	public void setENDSTATUS(String endstatus) {
		ENDSTATUS = endstatus;
	}

	@Column(name = "ACTIONTYPE", nullable = false)
	public String getActionType() {
		return actionType;
	}

	public void setActionType(String actionType) {
		this.actionType = actionType;
	}

	@Column(name = "REMARK", nullable = false)
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((getActionTime() == null) ? 0 : getActionTime().hashCode());
		result = prime
				* result
				+ ((getTransferOrderId() == null) ? 0 : getTransferOrderId()
						.hashCode());
		return result;
	}

	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		TransferOrderActionDetail other = (TransferOrderActionDetail) obj;
		if (getActionTime() == null) {
			if (other.getActionTime() != null)
				return false;
		} else if (!getActionTime().equals(other.getActionTime()))
			return false;
		if (getTransferOrderId() == null) {
			if (other.getTransferOrderId() != null)
				return false;
		} else if (!getTransferOrderId().equals(other.getTransferOrderId()))
			return false;
		return true;
	}
}